<nav class="sidenav2">
  <div class="w3-container">
    {{ $currentNode := . }}
    <ul class="menu-l1">
      {{ range .Site.Menus.main }}
      <a{{ if $currentNode.IsMenuCurrent "main" . }} class="active"{{ end }} href="{{ substr .URL 0 -1 }}">{{ .Pre }} {{ .Name }}</a>
      <ul class="menu-l2">
        {{ range .Children }}
        <li>
          <a{{ if $currentNode.IsMenuCurrent "main" . }} class="active"{{ end }} href="{{ substr .URL 0 -1 }}">
            {{ .Pre }} {{ .Name }}
          </a>
          <ul class="menu-l3">
            {{ range .Children }}
            <li>
              <a{{ if $currentNode.IsMenuCurrent "main" . }} class="active"{{ end }} href="{{ substr .URL 0 -1 }}">
                {{ .Name }}
              </a>
            </li>
            {{ end }}
          </ul>
        </li>
        {{ end }}
      </ul>
      {{ end }}
    </ul>
  </div>
</nav>